<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateOrdersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('orders', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('uid')->unique()->comment('用户id');
            $table->integer('aid')->index()->comment('收货地址id');
            $table->integer('orders_num')->index()->comment('订单号');
            $table->tinyInteger('state')->comment('订单状态:0-待付款,1-待发货,2-待收货,3-交易成功');
            $table->double('orders_sum')->comment('订单总价格');
            $table->timestamp('pay_at')->nullable()->comment('付款时间');
            $table->timestamp('delivery_at')->nullable()->comment('发货时间');
            $table->timestamp('deal_at')->nullable()->comment('成交时间');
			$table->string('link_man', 50)->comment('收货人');
			$table->char('phone', 11)->comment('收货人联系电话');
			$table->string('address', 100)->comment('收货人地址');
			$table->char('code',6)->comment('邮编');
			$table->timestamps();
			$table->string('attr1' ,50)->nullable();
			$table->string('attr2' ,100)->nullable();
			$table->string('attr3' ,150)->nullable();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('orders');
    }
}